package com.jyw.flowable.service.impl;

import java.time.LocalDateTime;
import java.util.List;

import com.jyw.common.utils.DateUtils;
import com.jyw.flowable.domain.WfCategory;
import com.jyw.flowable.mapper.WfCategoryMapper;
import com.jyw.flowable.service.IWfCategoryService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import javax.annotation.Resource;

/**
 * 流程分类Service业务层处理
 *
 * @author zhangcheng
 * @date 2023-10-31
 */
@Service
public class WfCategoryServiceImpl extends ServiceImpl<WfCategoryMapper, WfCategory> implements IWfCategoryService {
    @Resource
    private WfCategoryMapper wfCategoryMapper;

    /**
     * 查询流程分类
     *
     * @param id 流程分类主键
     * @return 流程分类
     */
    @Override
    public WfCategory selectWfCategoryById(Long id) {
        return wfCategoryMapper.selectWfCategoryById(id);
    }

    /**
     * 查询流程分类列表
     *
     * @param wfCategory 流程分类
     * @return 流程分类
     */
    @Override
    public List<WfCategory> selectWfCategoryList(WfCategory wfCategory) {
        return wfCategoryMapper.selectWfCategoryList(wfCategory);
    }

    /**
     * 新增流程分类
     *
     * @param wfCategory 流程分类
     * @return 结果
     */
    @Override
    public int insertWfCategory(WfCategory wfCategory) {
        wfCategory.setCreateTime(LocalDateTime.now());
        return wfCategoryMapper.insertWfCategory(wfCategory);
    }

    /**
     * 修改流程分类
     *
     * @param wfCategory 流程分类
     * @return 结果
     */
    @Override
    public int updateWfCategory(WfCategory wfCategory) {
        wfCategory.setUpdateTime(LocalDateTime.now());
        return wfCategoryMapper.updateWfCategory(wfCategory);
    }

    /**
     * 批量删除流程分类
     *
     * @param ids 需要删除的流程分类主键
     * @return 结果
     */
    @Override
    public int deleteWfCategoryByIds(Long[] ids) {
        return wfCategoryMapper.deleteWfCategoryByIds(ids);
    }

    /**
     * 删除流程分类信息
     *
     * @param id 流程分类主键
     * @return 结果
     */
    @Override
    public int deleteWfCategoryById(Long id) {
        return wfCategoryMapper.deleteWfCategoryById(id);
    }
}
